/*
* BoundingRectangle.cpp
*
*  Created on: Jan 21, 2011
*      Author: Helpful Learn Group
*/

#include "BoundingRectangle.h"

namespace GSP280
{
	//C002: OVERLOADED CONSTRUCTOR
	BoundingRectangle::BoundingRectangle ( const Vector2 &vec, const int width, const int height )
	{
		Location.setVector2(vec);
		this->width = width;
		this->height = height;
	}


	//==============================================
	//IMPLEMENTING SHAPE ABSTRACT CLASS METHODS.....
	//==============================================

	//M001: Get Height data member
	const int GSP280::BoundingRectangle::getHeight ( ) const
	{
		return this->height;
	}

	//M002: Set Height data member
	void GSP280::BoundingRectangle::setHeight ( const int &height )
	{
		this->height = height;
	}

	//M003: Get Width data member
	const int GSP280::BoundingRectangle::getWidth ( ) const
	{
		return this->width;
	}

	//M004: Set Width data member
	void GSP280::BoundingRectangle::setWidth ( const int &width )
	{
		this->width = width;
	}

	//M005: Calculate Obj Area
	const double GSP280::BoundingRectangle::calcArea ( ) const
	{
		return ( double(width * height) );
	}

	//M006: Set Obj Location by Vector
	void GSP280::BoundingRectangle::setLocation ( const Vector2 & vect )
	{
		Location.setVector2(vect);
	}

	//M007: Set Obj Location by x,y values
	void GSP280::BoundingRectangle::setLocation ( const float &_x, const float &_y )
	{
		Location.setVector2(_x, _y);
	}

	//M008: Set Obj Location_X
	void GSP280::BoundingRectangle::setLocation_X ( const float &_x )
	{
		Location.setX(_x);
	}

	//M009: Set Obj Location_Y
	void GSP280::BoundingRectangle::setLocation_Y ( const float &_y )
	{
		Location.setY(_y);
	}

	//M010: Get Obj Location by Vector
	const Vector2 GSP280::BoundingRectangle::getLocation ( ) const
	{
		return ( Location.getVector2() );
	}

	//M011: Get Obj Location_X
	const float GSP280::BoundingRectangle::getLocation_X ( ) const
	{
		return ( Location.getX() );
	}

	//M012: Get Obj Location_Y
	const float GSP280::BoundingRectangle::getLocation_Y ( ) const
	{
		return ( Location.getY() );
	}
}//namespace




/*
bool BoundingRectangle::intersects(BoundingRectangle rect)
	{
		bool intersects = false;

		if((left <= rect.left && rect.left <= right) ||
			(left <= rect.right && rect.right <= right ) ||
			(rect.left <= left && left <= rect.right) ||
			(rect.left <= right && right <= rect.right))
		{
			if((top <= rect.top && rect.top <= bottom) ||
				(top <= rect.bottom && rect.bottom <= bottom ) ||
				(rect.top <= top && top <= rect.bottom) ||
				(rect.top <= bottom && bottom <= rect.bottom))
			{
				intersects = true;
			}
		}

		return intersects;
	}
	*/
